package hu.ikti.gateway;

import java.util.Hashtable;

import hu.ikti.gateway.impl.ConfigService;
import hu.ikti.gateway.impl.ConnectionChecker;
import hu.ikti.gateway.impl.CustomLogService;
import hu.ikti.gateway.impl.WebserviceHandler;

import org.osgi.service.cm.ManagedService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class Activator implements BundleActivator{

	private static BundleContext context;
	public static ServiceRegistration configServiceRegistration;
	public WebserviceHandler wh;
	public ConnectionChecker cc;
	public ConfigService cs;
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext bundleContext) throws Exception {
		CustomLogService.info("GatewaySync started");
		context = bundleContext;
		/*Hashtable hash = new Hashtable();
		hash.put("service.pid", "hu.ikti.hgw.gwsync");
		configServiceRegistration = context.registerService(new String[] { ManagedService.class.getName() }, ConfigService
				.getInstance(), hash);*/
		cc = ConnectionChecker.getInstance();
		wh = WebserviceHandler.getInstance();
		cs = ConfigService.getInstance();
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext bundleContext) throws Exception {
		Activator.context = null;
	}

	public static BundleContext getContext() {
		return context;
	}

}
